﻿using BW.WMS.Application.Features.Supperss.Dtos;
using BW.WMS.Core.Result;
using BW.WMS.Domain.Entities.Supperrs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.WMS.Application.Features.Supperss.Interfice
{
    /// <summary>
    /// 供应商服务接口
    /// </summary>
    public interface ISupperServices
    {
        /// <summary>
        /// 获取供应商信息
        /// </summary>
        /// <param name="queryDto">查询条件</param>
        /// <returns>供应商产品列表</returns>
        ApiPage<SupplierModels> GetSupperProduct(SupperProductQueryDto queryDto);

        /// <summary>
        /// 分页查询产品信息
        /// </summary>
        /// <param name="queryDto">查询条件</param>
        /// <returns>分页结果</returns>
        ApiPage< ProductModel> GetSupperProductPage(ProducstDto queryDto);

        /// <summary>
        /// 添加供应商
        /// </summary>
        /// <param name="supplier">供应商信息</param>
        /// <returns>操作结果</returns>
        ApiResult<int> AddSupplier(SupplierModels supplier);

        /// <summary>
        /// 更新供应商
        /// </summary>
        /// <param name="supplier">供应商信息</param>
        /// <returns>操作结果</returns>
        ApiResult<int> UpdateSupplier(SupplierModels supplier);

        /// <summary>
        /// 删除供应商
        /// </summary>
        /// <param name="id">供应商ID</param>
        /// <returns>操作结果</returns>
        ApiResult<int> DeleteSupplier(int id);
        /// <summary>
        /// 获取所有商品列表（去重）
        /// </summary>
        /// <returns></returns>
       ApiResult<List<ProductModel>> GetAllProducts();

        /// <summary>
        /// 供应商
        /// </summary>
        /// <param name="id">供应商ID</param>
        /// <returns>供应商信息</returns>
        ApiResult<List< SupplierModels>> GetSupplierById();

        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="product">商品信息</param>
        /// <returns>操作结果</returns>
        ApiResult<int> AddProduct(ProductModel product);

        /// <summary>
        /// 更新商品
        /// </summary>
        /// <param name="product">商品信息</param>
        /// <returns>操作结果</returns>
        ApiResult<bool> UpdateProduct(ProductModel product);

        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="id">商品ID</param>
        /// <returns>操作结果</returns>
        ApiResult<int> DeleteProduct(int id);

        /// <summary>
        /// 根据供应商ID获取商品列表
        /// </summary>
        /// <param name="supplierId">供应商ID</param>
        /// <returns>商品列表</returns>
        ApiResult<List<ProductModel>> GetProductsBySupplierId(int supplierId);

        /// <summary>
        /// 为供应商分配商品
        /// </summary>
        /// <param name="assignmentDto">分配信息</param>
        /// <returns>操作结果</returns>
        ApiResult<int> AssignProductToSupplier(SupplierProductAssignmentDto assignmentDto);

        /// <summary>
        /// 移除供应商商品分配
        /// </summary>
        /// <param name="id">分配记录ID</param>
        /// <returns>操作结果</returns>
        ApiResult<bool> RemoveProductFromSupplier(int id);

        /// <summary>
        /// 获取供应商已分配的商品列表
        /// </summary>
        /// <param name="queryDto">查询条件</param>
        /// <returns>分页结果</returns>
        ApiPage<SupplierProductInfoDto> GetSupplierProducts(SupplierProductQueryDto queryDto);

        /// <summary>
        /// 获取可分配给供应商的商品列表
        /// </summary>
        /// <param name="supplierId">供应商ID</param>
        /// <returns>可分配商品列表</returns>
        ApiResult<List<AvailableProductDto>> GetAvailableProducts(int supplierId);

        /// <summary>
        /// 更新供应商商品分配信息
        /// </summary>
        /// <param name="assignmentDto">分配信息</param>
        /// <returns>操作结果</returns>
        ApiResult<bool> UpdateSupplierProduct(SupplierProductAssignmentDto assignmentDto);

        /// <summary>
        /// 根据供应商ID获取可采购商品列表
        /// </summary>
        /// <param name="supplierId">供应商ID</param>
        /// <returns>商品列表</returns>
        ApiResult<List<SupplierProductInfoDto>> GetPurchaseProductsBySupplier(int supplierId);

        /// <summary>
        /// 创建采购单
        /// </summary>
        /// <param name="purchase">采购单信息</param>
        /// <returns>操作结果</returns>
        ApiResult<int> CreatePurchaseOrder(DbPurchaseList purchase);

        /// <summary>
        /// 分页查询采购单
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns>分页采购单</returns>
        ApiPage<DbPurchaseList> GetPurchaseOrderPage(PurchaseOrderQueryDto query);

        /// <summary>
        /// 查询进货列表（支持多种筛选条件）
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns>进货列表分页数据</returns>
        ApiPage<PurchaseListDto> GetPurchaseList(PurchaseListQueryDto query);

        /// <summary>
        /// 获取供应商下拉框数据
        /// </summary>
        /// <returns>供应商ID和名称列表</returns>
        ApiResult<List<SupplierDropdownDto>> GetSupplierDropdown();
    }
}
